package Test_1027;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 * Dare: 2024-10-27
 * Time: 13:57
 */
public class Test {
//洗牌：
  /*1.有52张牌；
    2.洗牌；
    3.3个人每个人抽一张牌轮5次*/
    public static void main(String[] args) {
        CardDemo cardDemo=new CardDemo();
        List<Card> cardList = cardDemo.buyCard();
        System.out.println(cardList);
        cardDemo.shuffle(cardList);
        System.out.println(cardList);
        List<List<Card>> ret = cardDemo.play(cardList);
        for (int i = 0; i < ret.size(); i++) {
            System.out.println("第"+(i+1)+"个人的牌"+ret.get(i));
        }
}
    //大小：size
    public static void main2(String[] args) {
        List<List<Integer>> ret=generate(5);
        for (int i = 0; i < ret.size(); i++) {
            for (int j = 0; j < ret.get(i).size(); j++) {
                System.out.print(ret.get(i).get(j)+" ");
            }
            System.out.println(
            );
        }
    }
    //杨辉三角 a[i][j]=a[i-1][j]+a[i-1][j-1]
    public static  List<List<Integer>> generate(int numRows)  {
        List<List<Integer>> ret=new ArrayList<>();
        List<Integer> list0=new ArrayList<>();
        list0.add(1);
        ret.add(list0);
        for (int i = 1; i < numRows; i++) {
            //第一个
           List<Integer> curRow=new ArrayList<>();
           curRow.add(1);
           //中间
            List<Integer> perRow=ret.get(i-1);
            for (int j = 1; j < i ; j++) {
                int val1=perRow.get(j);
                int val2=perRow.get(j-1);
                curRow.add(val1+val2);
            }
            //最后一个
           curRow.add(1);
           ret.add(curRow);
        }
        return ret;
    }
    public static void main1(String[] args) {
        List<List<Integer>> list=new ArrayList<>();
        List<Integer> list1=new ArrayList<>();
        list1.add(2);
        list1.add(3);
        list1.add(4);
        list.add(list1);
        List<Integer> list2=new ArrayList<>();
        list2.add(5);
        list2.add(6);
       list.add(list2);
        System.out.println(list);
    }
}
